<template>
  <div class="index">
  	<div class="sreePublic">
  		<div id="" style="text-align: center;">
  			<em class="iconfont" @click="vfun_back">&#xe61f;</em>
  		</div>
		忘记密码
  	</div>
  	<div>
  		<div class="delivery">
  			<ul>
  				<li>
  					<span>手机号</span>
  					<input v-model="phone2" placeholder="输入手机号" />
  				</li>
  				<li>
  					<span>验证码</span>
  					<input v-model="rendCode" placeholder="输入验证码"  />
  					<span class="yanzhnge" @click="vfun_huoqu" :class="{active:vue_phone_verifyBtn}" :disabled="!canClick">{{vue_ver}}</span>
  				</li>

  				<li>
  					<span>新密码</span>
  					<input type="password"  ref="password" v-model="operatorPayPassword"  placeholder="输入新密码" />
  					<a class="yanpass" @click="vfun_yan">
						<em class="iconfont" v-if="vue_yan">&#xe6e3;</em>
						<em class="iconfont" v-else>&#xe8ed;</em>
					</a>
  				</li>
  				<!--<li>
  					<span>确认密码</span>
  					<input type="password" v-model="operatorPayPassword2"/>
  				</li>-->
  			</ul>
  		</div>

	    <div class="footer">
	    	<a @click="addDelivery">保存</a>
	    </div>

	</div>
  </div>
</template>

<script>
	import * as address from '../../assets/data/address';
	import { MessageBox } from 'mint-ui';
	import { Toast } from 'mint-ui';  //引入弹框
export default {
  name: 'addDelivery',
  data () {
    return {
    		vue_yan:true,
    	  vue_ver:'获取验证码',
    	  vue_phone_verifyBtn:false,
    	  phone:'',
    	  phone2:'',
    	  operatorPayPassword:'',
    	  rendCode:'',
    	  operatorPayPassword2:'',
      canClick:true,  //验证码能否点击
    }
  },
  methods:{
  	vfun_yan(){
		  		this.vue_yan=!this.vue_yan;
		  		if (this.vue_yan) {
							this.$refs['password'].type = "password";
						} else{
							this.$refs['password'].type = "text";
						}
		  	},
  	vfun_huoqu(){

  		if (this.phone2 !='') {
  			let str=this.Public.rules.phone;

			if(str.test(this.phone2) != true){
				Toast({
				  message: '手机号格式错误',
				  iconClass: 'fontSize iconfont icon-shibai'
				});
//						MessageBox('提示', '请填写正确的手机号');
				return false;
			}
  		}else{
  			Toast({
				  message: '请填写手机号',
				  iconClass: 'fontSize iconfont icon-shibai'
				});
  			return false;
  		}
  		let num = 60;
			this.vue_phone_countDown = setInterval(()=>{
        this.canClick = false;
				this.vue_ver = num+"后重新获取";
				this.vue_phone_verifyBtn=true;
				num--;
				if(num<=-1){
					clearInterval(this.vue_phone_countDown);
					this.vue_phone_verifyBtn=false;
					this.vue_ver = "重新获取";
				}
			},1000);
		this.axios({
			method: 'PATCH',
			url: "/v3/member/operators/"+this.phone2+"/sendPhoneVerifyCode",
			data:{
			}
			}).then((res) => {

			}).catch((err)=>{
				Toast({
				  message: err.response.data,
				  iconClass: 'fontSize iconfont icon-shibai'
				});
	  	});

  	},
	addDelivery(){
		if (this.rendCode=='') {
			Toast({
				  message: '请填写验证码',
				  iconClass: 'fontSize iconfont icon-shibai'
				});
			return false;
		}
		if (this.operatorPayPassword!='') {

		} else{
			Toast({
			  message: '请填写密码',
			  iconClass: 'fontSize iconfont icon-shibai'
			});
			return false;
		}

		if (this.operatorPayPassword!=this.operatorPayPassword2) {
			Toast({
				  message: '密码不一致',
				  iconClass: 'fontSize iconfont icon-shibai'
				});
			return false;
		}
//		this.axios({
//			method: 'PUT',
//			url: "/v3/member/operators/"+this.rendCode+"/"+this.md5(this.operatorPayPassword).toUpperCase()+"/settlePayPassword",
//			data:{
//			}
//			}).then((res) => {
//				Toast({
//				  message: '设置成功',
//				  iconClass: 'fontSize iconfont icon-chenggong'
//				});
//			}).catch((err)=>{
//				Toast({
//				  message: err.response.data,
//				  iconClass: 'fontSize iconfont icon-shibai'
//				});
//	  	});



	},
  	vfun_back(){
  		history.back();
  	},

  },
  watch: {

  },
    created(){
    },
  mounted(){

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
*{
	transition: 0.2s;
}
h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}
.index{
	box-sizing: border-box;
	margin-bottom: 1.5rem;
}

.delivery{
	margin-top: 1.2rem;
}
.delivery li{
	border-bottom: 1px solid #e7e7e7;
	box-sizing: border-box;
	background: #fff;
	height: 1.5rem;
	line-height: 1.5rem;
	position: relative;
	width: 90%;
	margin: 0 auto;
	font-size: 16px;
}

.delivery input{
	border: 0;
	text-indent: 0.2rem;
	height: 1rem;
}
.delivery .yanzhnge{
	display: block;
	position: absolute;
	height: 1rem;
	line-height:1rem;
	right: 5%;
	top: 0.25rem;
	font-size: 14px;
	border-left:1px solid #e7e7e7;
	padding-left: 0.2rem;
}
.pass{
	position: absolute;
	padding: 0.15rem 0.2rem;
	right: 6%;
	top: 19%;
	color: #b0b0b0;
}
.footer{
	position: fixed;
	background: #fff;
	bottom: 0;
	width: 100%;
}
.footer a{
	display: block;
	width: 98%;
	margin-left: 1%;
	margin-bottom: 1%;
	color: #fff;
	text-align: center;
	height: 1.4rem;
	background: #D50B0A;
	line-height: 1.4rem;
  font-size: 16px;
	border-radius:4px ;
}
.delivery .iconfont{
	float: right;
	color: #ccc;
	font-size: 14px;
}
.deliverytab{
	width: 10rem;
	height: 9rem;
}
.delivery-th{
	margin-top: 0.4rem;color: #D50B0A;
}
.delivery-th span:first-child{
	float: left;
	margin-left: 5%;
}
.delivery-th span:last-child{
	float: right;
	margin-right: 5%;
}
.active{
	pointer-events: none;
}
.phone{
	color: #b0b0b0;
	background: #fff;
}
.yanpass{
		position: relative;
		top: 0.2rem;
	}
	.yanpass em{
		color: #b8b8b8;
		font-size: 18px!important;
	}
</style>
